home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
tex
/
mf
/
rexx
/
namestruc
< prev
next >
Wrap
Text File
|
1993-09-29
|
803b
|
27 lines
/*
** AREXX $VER: NameStruc V1.0 (13.09.1992)
**
** This ARexx script accepts a filename and returns three lengthes (not
** strings, to avoid problems with embedded spaces) corresponding to the
** main parts of this filename.
**
** Example: RAM:foo/bar/nasty.tar.Z
** ^ ^ ^
** volume : 4 (RAM:)
** subdirlen: 8 (foo/bar/) NOTE : The trailing slash is included.
** baselen : 9 (nasty.tar) NOTE : if no extension, whole length.
*/
Parse Arg FULLNAME /* FULLNAME = strip(FULLNAME,'L') */
VOLUME = Index(FULLNAME,":")
SUBDIRLEN = LastPos("/",SubStr(FULLNAME,1+VOLUME))
FILEONLY = SubStr(FULLNAME,VOLUME+1+SUBDIRLEN)
BASELEN = LastPos(".",FILEONLY)
If 0 = BASELEN Then
BASELEN = Length(FILEONLY)
Else
BASELEN = BASELEN - 1
Return VOLUME' 'SUBDIRLEN' 'BASELEN